package payroll.trans;

import payroll.Employee;
import payroll.PaymentClassification;
import payroll.PayrollDatabase;
import payroll.Transaction;
import payroll.method.HoldMethod;

public abstract class AddEmployeeTransaction implements Transaction {
    private int id;
    private String name;
    private String address;

    public AddEmployeeTransaction(int id, String name, String address) {
        this.id = id;
        this.name = name;
        this.address = address;
    }
    @Override
    public void execute() {
        Employee e = new Employee(id, name, address);
        e.setPaymentClassification(getPaymentClassification());
        e.setPaymentMethod(new HoldMethod());
        PayrollDatabase.saveEmployee(e);
    }
    protected abstract PaymentClassification getPaymentClassification();
}
